import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;

/**
 * Reducer class for the distributed Breadth First Search.  Essentially this
 * performs a min on the distances to the given key and emmits <key,
 * Dist:link0;link1;...;link2> Determines the list of links from the first
 * pair emmitted by a map job - the key value pair containing the old
 * distance.
 *
 * This might be the identity reducer.
 *
 * @author Ryan Hofler
 * @version 0.1
 */
public class FinalReducer extends MapReduceBase
    implements Reducer<IntWritable, Text, IntWritable, Text> {
    public void reduce(IntWritable key,
		       Iterator<Text> values,
		       OutputCollector<IntWritable, Text> output,
		       Reporter reporter)
	throws IOException {

        // Identity Reducer anyone?

        while(values.hasNext())
            output.collect(key, values.next());
    }
}


